#define  _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
bool isUgly(int n) {
    if (n == 0)return false;
    while (n) {
        if (n % 2 == 0) {
            n /= 2;
        }
        else if (n % 3 == 0) {
            n /= 3;
        }
        else if (n % 5 == 0) {
            n /= 5;
        }
        else if (n == 1) {
            return true;
        }
        else {
            return false;
        }
    }
    return true;
}
int nthUglyNumber(int n) {
    int dp[n + 1];
    dp[1] = 1;
    int p2 = 1, p3 = 1, p5 = 1;
    for (int i = 2; i <= n; i++) {
        int num2 = dp[p2] * 2, num3 = dp[p3] * 3, num5 = dp[p5] * 5;
        dp[i] = fmin(fmin(num2, num3), num5);
        if (dp[i] == num2) {
            p2++;
        }
        if (dp[i] == num3) {
            p3++;
        }
        if (dp[i] == num5) {
            p5++;
        }
    }
    return dp[n];
}

int main()
{

	return 0;
}